<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RolePower extends Model
{
    protected $table = 'role_power';

    protected $dateFormat = 'U';
    protected $guarded = ["created_at", "updated_at", "id"];
    protected $hidden = ['deleted_at'];
    protected $casts = [
        'created_at' => 'timestamp',
        'updated_at' => 'timestamp'
    ];


    public function power(){
        return $this->belongsTo(Power::class);
    }

    public function role(){
        return $this->belongsTo(Roles::class);
    }

    public function getPowerNameAttribute(){
        return $this->power->power_name;
    }

    public function getRoleNameAttribute(){
        return $this->role->role_name;
    }
}
